Filter hook 'hooked_block_{$hooked_block_type}'

in WP Core File wp-includes/blocks.php at line 1044

View Source

hooked_block_{$hooked_block_type}

Filter Hook
Description
Adds a list of hooked block types to an anchor block's ignored hooked block types. This function is meant for internal use only.

Hook Information

File Location wp-includes/blocks.php View on GitHub
Hook Type Filter
Line Number 1044

Hook Parameters

Type Name Description
array $parsed_anchor_block The anchor block, in parsed block array format.
string $relative_position The relative position of the hooked blocks. Can be one of 'before', 'after', 'first_child', or 'last_child'.
array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.

Usage Examples

Basic Usage
<?php
// Hook into hooked_block_{$hooked_block_type}
add_filter('hooked_block_{$hooked_block_type}', 'my_custom_filter', 10, 4);

function my_custom_filter($parsed_anchor_block, $relative_position, $hooked_blocks, $context) {
    // Your custom filtering logic here
    return $parsed_anchor_block;
}

Source Code Context

wp-includes/blocks.php:1044 - How this hook is used in WordPress core
<?php
1039  
1040  		/** This filter is documented in wp-includes/blocks.php */
1041  		$parsed_hooked_block = apply_filters( 'hooked_block', $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
1042  
1043  		/** This filter is documented in wp-includes/blocks.php */
1044  		$parsed_hooked_block = apply_filters( "hooked_block_{$hooked_block_type}", $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
1045  
1046  		if ( null === $parsed_hooked_block ) {
1047  			unset( $hooked_block_types[ $index ] );
1048  		}
1049  	}

PHP Documentation

<?php
/**
 * Adds a list of hooked block types to an anchor block's ignored hooked block types.
 *
 * This function is meant for internal use only.
 *
 * @since 6.5.0
 * @access private
 *
 * @param array                           $parsed_anchor_block The anchor block, in parsed block array format.
 * @param string                          $relative_position   The relative position of the hooked blocks.
 *                                                             Can be one of 'before', 'after', 'first_child', or 'last_child'.
 * @param array                           $hooked_blocks       An array of hooked block types, grouped by anchor block and relative position.
 * @param WP_Block_Template|WP_Post|array $context             The block template, template part, or pattern that the anchor block belongs to.
 * @return string Empty string.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/blocks.php
Related Hooks

Related hooks will be displayed here in future updates.